//
//  BookModel.m
//  i读
//
//  Created by 朱经扬 on 15/11/18.
//  Copyright © 2015年 123. All rights reserved.
//

#import "BookModel.h"
//#import "MJExtension.h"

@implementation BookModel

+ (NSDictionary *)replacedKeyFromPropertyName{
    return @{@"descriptions":@"description"};
}

- (NSString *)description{
    return [NSString stringWithFormat:@"BookModel:\n bookId = %@ \n name = %@ \n price = %@ \n author = %@ \n press = %@ \n pressDate = %@ \n isbn = %@ \n number = %@ \n page = %@ \n description = %@ \n catalog = %@ \n img = %@ \n",@(self.bookId),self.name,self.price,self.author,self.press,self.pressDate,self.isbn,self.number,self.page,self.descriptions,self.catalog,self.img];
}


- (instancetype)initWithCoder:(NSCoder *)aDecoder{
    self = [super init];
    if (self) {
        self.bookId = [aDecoder decodeIntegerForKey:@"bookId"];
        self.name = [aDecoder decodeObjectForKey:@"name"];
        self.price = [aDecoder decodeObjectForKey:@"price"];
        self.author = [aDecoder decodeObjectForKey:@"author"];
        self.press = [aDecoder decodeObjectForKey:@"press"];
        self.pressDate = [aDecoder decodeObjectForKey:@"pressDate"];
        self.isbn = [aDecoder decodeObjectForKey:@"isbn"];
        self.number = [aDecoder decodeObjectForKey:@"number"];
        self.page = [aDecoder decodeObjectForKey:@"page"];
        self.descriptions = [aDecoder decodeObjectForKey:@"descriptions"];
        self.catalog = [aDecoder decodeObjectForKey:@"catalog"];
        self.img = [aDecoder decodeObjectForKey:@"img"];
        self.isSecret = [aDecoder decodeObjectForKey:@"isSecret"];
        self.isComplete = [aDecoder decodeObjectForKey:@"isComplete"];
        self.todayPercent = [aDecoder decodeDoubleForKey:@"todayPercent"];
        self.percent = [aDecoder decodeDoubleForKey:@"percent"];
        
    }
    return self;
}


- (void)encodeWithCoder:(NSCoder *)aCoder{
    [aCoder encodeInteger:self.bookId forKey:@"bookId"];
    [aCoder encodeObject:self.name forKey:@"name"];
    [aCoder encodeObject:self.price forKey:@"price"];
    [aCoder encodeObject:self.author forKey:@"author"];
    [aCoder encodeObject:self.press forKey:@"press"];
    [aCoder encodeObject:self.pressDate forKey:@"pressDate"];
    [aCoder encodeObject:self.isbn forKey:@"isbn"];
    [aCoder encodeObject:self.number forKey:@"number"];
    [aCoder encodeObject:self.page forKey:@"page"];
    [aCoder encodeObject:self.descriptions forKey:@"descriptions"];
    [aCoder encodeObject:self.catalog forKey:@"catalog"];
    [aCoder encodeObject:self.img forKey:@"img"];
    [aCoder encodeObject:self.isSecret forKey:@"isSecret"];
    [aCoder encodeObject:self.isComplete forKey:@"isComplete"];
    [aCoder encodeDouble:self.todayPercent forKey:@"todayPercent"];
    [aCoder encodeDouble:self.percent forKey:@"percent"];
    
}




@end
